export function searchColumns() {
  return [
    {
      prop: 'status',
      type: 'select',
      dicData: [
        { value: 1, label: '启用' },
        { value: 2, label: '禁用' },
      ],
      filterable: true,
      props: {
        value: 'value',
        label: 'label',
      },
      placeholder: '请选择活动动态',
    },
    {
      prop: 'page_type',
      type: 'select',
      dicData: [
        { value: 0, label: 'Top up' },
        { value: 1, label: '弹窗充值' },
      ],
      filterable: true,
      placeholder: '请选择活动动态',
    },
  ]
}

export function tableColumns() {
  const status = [
    { value: 0, label: 'Top up' },
    { value: 1, label: '弹窗充值' },
  ]
  return [
    {
      label: '序号',
      prop: 'id',
      width: 80,
    },
    {
      label: '活动名称',
      prop: 'name',
      align: 'left',
    },
    {
      label: '展示页面',
      prop: 'page_type',
      align: 'left',
      formatter: row => status[row?.page_type]?.label,
    },
    {
      label: '状态',
      prop: 'status',
      html: true,
      width: 80,
      formatter: row =>
        `<span class="${row?.status === 1 ? 'text-success' : 'text-danger'}">${
          row?.status === 1 ? '启用' : '禁用'
        }</span>`,
    },
    {
      label: '定价($)',
      prop: 'price',
      align: 'right',
      formatter: row => row?.price / 10000,
    },
    {
      label: '金币',
      prop: 'coins',
      align: 'right',
      formatter: row => row?.coins / 10000,
    },
    {
      label: '奖金',
      prop: 'bonus',
      align: 'right',
      formatter: row => row?.bonus / 10000,
    },
    {
      label: '奖金到期时间',
      prop: 'bonus_expired',
      width: 140,
      formatter: row =>
        `用户购买后,${row?.bonus_expired === 600 ? '10' : row?.bonus_expired / 86400}${
          row?.bonus_expired === 600 ? '分钟' : '天'
        }`,
    },

    {
      label: '最近一次操作时间',
      prop: 'updated_at',
      width: 140,
      formatter: row => this.$formatTime(row?.updated_at),
    },
  ]
}
